package services

import (
	"jianianhua-server/database"
	"jianianhua-server/models"
)

// ProductService 商品服务
type ProductService struct{}

// NewProductService 创建商品服务实例
func NewProductService() *ProductService {
	return &ProductService{}
}


// GetProductByID 根据ID获取商品信息
func (s *ProductService) GetProductByID(productID int) (*models.Product, error) {
	var product models.Product
	err := database.DB.Where("id = ?", productID).First(&product).Error
	if err != nil {
		return nil, err
	}
	return &product, nil
}
